import { lazy } from 'react'
import { Navigate } from 'react-router-dom'
import type { RoutePropsExtend } from './route.ts'
import RuomRouters from './ruom.tsx'
import RuimRouters from './ruim.tsx'
import { _PAGE_ } from '@/consts/system.ts'
// 路由懒加载
const Demo = lazy(() => import('@/pages/demo'))
const Loading = lazy(() => import('@/pages/system/loading'))
const PageResult = lazy(() => import('@/components/results/result.tsx'))

const routes: Array<RoutePropsExtend> = [
  {
    path: '/',
    element: <Navigate to={_PAGE_.def}></Navigate>
  },
  {
    path: '/demo',
    element: <Demo></Demo>
  },
  {
    path: '/loading/:save',
    element: <Loading></Loading>
  },
  ...RuomRouters,
  ...RuimRouters,
  {
    path: '/404',
    element: <PageResult state={'404'}></PageResult>
  },
  {
    path: '*',
    element: <Navigate to={_PAGE_.err}></Navigate>
  }
]

export default routes
